<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>

<link href="${path }/SpringMVC_Spring_mybatis/css/upload.css" rel="stylesheet" type="text/css" />

<jsp:include page="../comment/import.jsp"></jsp:include>

<title>轮播图片管理 - 轮播图详情</title>
</head>
<body>

<article class="cl pd-20">
	<form action="" method="post" class="form form-horizontal" id="form-admin-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">轮播图名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="${banner.bannerName }" placeholder="" id="bannerName" name="bannerName">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">轮播图描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="" cols="" rows="" class="textarea"  placeholder="说点什么...100个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)">${banner.bannerDesc }</textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
			</div>
		</div>
		<div class="row cl">
		    <label class="form-label col-xs-4 col-sm-2">轮播封面图：</label>
			<div class="upload" id="upload">
				 <c:if test="${empty banner.bannerImgUrl }">
			        <div class="uploader">
			            <input type="file"  name="upload" id="uploadInput">
			            <label for="uploadInput">选择文件</label>
			        </div>
			        <div class="imgShow">
			            <img src="" />
			            <div class="delete">删除</div>
			        </div>
				 </c:if>
				 <c:if test="${!empty banner.bannerImgUrl }">
			        <div class="uploader" style="display:none">
			            <input type="file"  name="upload" id="uploadInput">
			            <label for="uploadInput">选择文件</label>
			        </div>
			        <div class="imgShow" style="display:inline-block">
			            <img src="${imgUrl }${banner.bannerImgUrl }" />
			            <div class="delete">删除</div>
			        </div>
				 </c:if>
		    </div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onClick="saveOrEditBanner();" class="btn btn-primary radius" type="button"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
				<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</article>

<script rel="script" type="application/javascript" src="${path }/SpringMVC_Spring_mybatis/js/uploader.js"></script>
<script type="text/javascript">
  $(function () {
      /*初始化upload*/
     var upload=new initUpload($("#upload"));
     upload.init();
  });
  
function saveOrEditBanner(){

	var opt={
			
			banId:$("#banId").val(),
			banTitle : $("#banTitle").val(),
			banType : $("#banType").val(),
			banLink : $("#banLink").val(),
			banLinkid : $("#banLinkid").val(),
			playDate : $("#playDate").val(),
			banShareLink : $("#banShareLink").val(),
			banDesc : $("#banDesc").val(),
			banInsidetype : $("#banInsidetype").val(),
			banInsidelink : $("#banInsidelink").val(),
			banAppimgurl : $("#upload img").attr("src"),
			banPcimgurl : $("#upload2 img").attr("src"),
			banShareimgurl : $("#upload3 img").attr("src")
			
	};
	
	$.post(path+"/banner/saveOrEditBanner", opt, function(res) {
		if(res.code=="0"){
       	 	
			window.wxc.xcConfirm(res.errorMessage, window.wxc.xcConfirm.typeEnum.error);
			
        }else{
        	
			window.location=path+"/banner/banner";
        }
	});
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>